/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  NativeModules,
  TouchableOpacity
} from 'react-native';

import CustomView from './CustomView'
var IOSImageManager = NativeModules.LocalCustomView;
export default class RNOCMutuallyDemo extends Component {
  constructor(props) {
    super(props);
  
    this.state = {
      chooseString:'等待用户操作'
    };
  }
  render() {
    return (
      <View style={styles.container}>
      <TouchableOpacity onPress={()=>{
        IOSImageManager.alertChooseWithCallBack((sureOrNot)=>{
          this.setState({
            chooseString:sureOrNot
          })
        });
      }}>
      <View>
          <Text>点我</Text>
          <Text>{this.state.chooseString}</Text>
        </View>
      </TouchableOpacity>
        <CustomView 
        titleString={'我是标题'}
        contentString={'我是内容'}
        style={styles.customViewStyle}
      />
      </View>
    );
  }
}

const styles = StyleSheet.create({
 container: {
    flex: 1,
    backgroundColor: '#F5FCFF',
    justifyContent:'center',
    alignItems:'center',

  },
  customViewStyle:{
    width:300,
    height:300,
    backgroundColor:'white'
  }
});

AppRegistry.registerComponent('RNOCMutuallyDemo', () => RNOCMutuallyDemo);
